﻿/// <reference path="jquery-2.1.4.min.js" />
/// <reference path="createjs.js" />

var bgW = $(window).width();
bgW = 640;
var bgH = $(window).height();
//$("#shipin").attr({"width":bgW,"height":bgH});
var stage = new createjs.Stage("gameView");
var Container0 = new createjs.Container;
var Container1 = new createjs.Container;
var Container2 = new createjs.Container;
var Container6 = new createjs.Container;
var Container7 = new createjs.Container;
var Container8 = new createjs.Container;
var Container81 = new createjs.Container;
var Container82 = new createjs.Container;
var Container83 = new createjs.Container;
var Container9 = new createjs.Container;
var Container10 = new createjs.Container;
var Container11 = new createjs.Container;
var imgContainer = new createjs.Container;
var imgnewContainer = new createjs.Container;
var queue = new createjs.LoadQueue();
createjs.Sound.alternateExtensions = ["mp3,wav"];
queue.installPlugin(createjs.Sound);
var LoadCanvas = function() {

	/////////////////////////启动触摸
	createjs.Touch.enable(stage);
	queue.loadManifest([
		{id:"p6_kuang",src:"p6/p6_kuang.png"},
		{id:"p11_text1",src:"p11/p11_text1.png"},
		{id:"p11_text2",src:"p11/p11_text2.png"},
		{id:"p11_text3",src:"p11/p11_text3.png"},
		{id:"p11_text4",src:"p11/p11_fenxiang4.png"},
		{id:"p11_text5",src:"p11/p11_fenxiang5.png"},
		{id:"p11_text6",src:"p11/p11_fenxiang6.png"},
		{id:"p9_bg",src:"p9/p9_bg.jpg"},
	], true, "image/");
	queue.on("progress", function(event) {
		if (queue.progress.toString().length > 4) {
			progress = queue.progress.toString().substr(2, 2);
		} else {
			if (queue.progress.toString().length == 3 || queue.progress.toString().length == 4) {
				progress = queue.progress * 100;
			}

			progress = queue.progress;
		}
		if (progress.toString().indexOf(".") <= 0) {
			if (progress == "00") {
				progress = "0";
			}
			//          baifenbi.text = progress + "%";
			if (progress == "1") {
				progress = "100";
				$(".loading").hide();
			}
			$(".jindutiao").html(progress + "%");
		}

	});
	queue.on("complete", handleComplete, this);
}
//var bg,logo1,logo2;
var handleComplete = function() {
	Load0();
	Load11();
	createjs.Ticker.setFPS(60);
	createjs.Ticker.addEventListener("tick", function(event) {
		stage.update();
	})
}

var p6_kuang,p9_bg;
var Load0 = function(){
	
	p6_kuang = new createjs.Bitmap(queue.getResult("p6_kuang"));
	p6_kuang.x = (bgW-p6_kuang.getBounds().width)/2;
	p6_kuang.y = 50;
	
	p9_bg = new createjs.Bitmap(queue.getResult("p9_bg"));
	p9_bg.scaleX = bgW/p9_bg.getBounds().width;
	p9_bg.scaleY = bgH/p9_bg.getBounds().height;
	stage.addChild(p9_bg,p6_kuang);
	
}

var Load11 = function(){
	$("#info").css("display","none");
	
	stage.addChild(Container11);
	var p11_text1 = new createjs.Bitmap(queue.getResult("p11_text1"));
	p11_text1.x = p6_kuang.x + 190;p11_text1.y = p6_kuang.y +0;
	var p11_text2 = new createjs.Bitmap(queue.getResult("p11_text2"));
	p11_text2.x = p6_kuang.x + 140;p11_text2.y = p6_kuang.y +238;
	var p11_text3 = new createjs.Bitmap(queue.getResult("p11_text3"));
	p11_text3.x = p6_kuang.x + 140;p11_text3.y = p6_kuang.y +310;
	var p11_text4 = new createjs.Bitmap(queue.getResult("p11_text4"));
	p11_text4.x = p6_kuang.x + 181;p11_text4.y = p6_kuang.y +379;
	var p11_text5 = new createjs.Bitmap(queue.getResult("p11_text5"));
	p11_text5.x = p6_kuang.x + 82;p11_text5.y = p6_kuang.y +460;
	var p11_text6 = new createjs.Bitmap(queue.getResult("p11_text6"));
	p11_text6.x = p6_kuang.x + 97;p11_text6.y = p6_kuang.y +815;
	$("#fx_xingming").css({"display":"block","top":p6_kuang.y+460});
	
	var shape = new createjs.Shape;
	shape.graphics.beginFill("black").drawRect(0,0,bgW,bgH);
	Container11.addChild(p11_text1,p11_text2,p11_text3,p11_text4,p11_text5,p11_text6);
	p11_text5.addEventListener("mousedown",function(){
		shape.alpha = 0.8;p11_share.alpha = 1;
		$("#fx_xingming").css("display","none");
	})
	shape.addEventListener("mousedown",function(){
		shape.alpha = p11_share.alpha = 0;
		$("#fx_xingming").css("display","block");
	})
	p11_text1.alpha =p11_text2.alpha =p11_text3.alpha =p11_text4.alpha =p11_text5.alpha =p11_text6.alpha =0;
	var jishi = 800;
	var juli = 8;
	$("#fx_xingming").hide();
	$("#erweima").css({"display":"none","left":p6_kuang.x+215,"top":p6_kuang.y+658});
	createjs.Tween.get(p11_text1).to({y:p11_text1.y-juli}).to({alpha:1,y:p11_text1.y},jishi).call(function(){
		createjs.Tween.get(p11_text3).to({x:p11_text3.x+juli}).to({alpha:1,x:p11_text3.x},jishi);
		createjs.Tween.get(p11_text2).to({x:p11_text2.x-juli}).to({alpha:1,x:p11_text2.x},jishi).call(function(){
			createjs.Tween.get(p11_text4).to({y:p11_text4.y-juli}).to({alpha:1,y:p11_text4.y},jishi).call(function(){
				$("#fx_xingming").show();
				$("#erweima").show();
				createjs.Tween.get(p11_text5).to({alpha:1},jishi).call(function(){
					createjs.Tween.get(p11_text6).to({x:p11_text6.x-juli}).to({alpha:1,x:p11_text6.x},jishi);
				})
			});
		})
	})
}














































































